home *** CD-ROM | disk | FTP | other *** search
Wrap
/* File: FramingLibrary.c Contains: graphics libraries - Better gxShape framing routines Written by: Cary Clark, Georgiann Delaney, Michael Fairman, Dave Good, Robert Johnson, Keith McGreggor, Mike Reed, Oliver Steele, David Van Brink, Chris Yerga Copyright: © 1995 by Apple Computer, Inc., all rights reserved. Change History (most recent first): <2> 1/9/95 JD changed 'boolean' to 'Boolean' <1> 1/9/95 JD First checked in. */ #include "GraphicsLibraries.h" void OutsetShape(gxShape source, Fixed outset) { gxShape temp = GXCopyToShape(nil, source); Boolean framed = GXGetShapeFill(source) < gxEvenOddFill; GXSetShapeFill(source, gxWindingFill); GXSetShapeFill(temp, gxClosedFrameFill); GXSetShapeStyleAttributes(temp, gxCenterFrameStyle); GXSetShapePen(temp, (outset < 0 ? -outset : outset) << 1); GXPrimitiveShape(temp); if (outset > 0) /* if we are outsetting */ GXUnionShape(source, temp); else if (outset < 0) /* if we are insetting */ GXDifferenceShape(source, temp); if (framed) GXSetShapeFill(source, gxClosedFrameFill); GXDisposeShape(temp); } void FrameShape(gxShape source, Fixed outset) { gxShape temp = GXCopyToShape(nil, source); gxShapeFill originalFill = GXGetShapeFill(source); GXSetShapeFill(temp, gxWindingFill); GXSetShapeFill(source, gxClosedFrameFill); GXSetShapeStyleAttributes(source, gxCenterFrameStyle); GXSetShapePen(source, (outset < 0 ? -outset : outset) << 1); GXPrimitiveShape(source); if (outset > 0) /* if we are outside framing */ GXDifferenceShape(source, temp); else if (outset < 0) /* if we are inside framing */ GXIntersectShape(source, temp); else /* the outset is 0 */ GXSetShapeFill(source, gxClosedFrameFill); GXDisposeShape(temp); }